//
//  FirstViewController.m
//  myFramework
//
//  Created by eason on 16/4/20.
//  Copyright © 2016年 普惠. All rights reserved.
//

#import "FirstViewController.h"
#import "ViewController.h"
#import "tmpView.h"
#import "TabBarController.h"

@implementation FirstViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    /*
    UIButton * button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.backgroundColor = [UIColor blueColor];
    button.frame = CGRectMake(100, 100, 80, 80);
    [button addTarget:self action:@selector(buttonAction) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
    */
    tmpView * tmpview = [[tmpView alloc] initWithFrame:CGRectMake(0, 0, gScreenWidth, gScreenHeight)];
    [self.view addSubview:tmpview];
    
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Go" style:UIBarButtonItemStyleDone target:self action:@selector(rightBarButtonItemClicked)];
    
    [[Api sharedInstance] asyncHumenIntroduceWithSuccess:^(TestModel *bean) {
        NSLogDebug(@"1234%@",bean.introduction);
    } WithErrorBlock:^(id errorCode, id errorMsg) {
        NSLog(@"%@,%@",errorCode, errorMsg);
    } WithFailureBlock:^{
        NSLog(@"网络异常");
    }];
}

- (void)buttonAction
{
    ViewController * vc = [[ViewController alloc] init];
    [self pushToViewController:vc animated:YES];
}

- (void)rightBarButtonItemClicked
{
    [(TabBarController *)[UIApplication sharedApplication].keyWindow.rootViewController setSelectedIndex:1];
}
@end
